from python_baway.common.xcommon import input_value_util_well


def xlogin():
    xname=input_value_util_well(str, 'User name?: ',
                                ((lambda x: len(str(x))), None),
                                username='Could not be empty',
                                xis_strip=False,
                                right_username='user',
                                xerror_prompt='Error occurred. Maybe because it is empty.')
    print('|' + xname + '|')
    xpwd=input_value_util_well(str, 'Your pwd?: ',
                               password='Could be empty.',
                               right_password='pwd',
                               xis_strip=False)
    print('|' + xpwd + '|')
    if 'user' == xname and 'pwd' == xpwd:
        return True
    else:
        return False


while not xlogin():
    print('Failed.')
else:
    print('Welcome.')
